<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui" 
                xmlns:f="http://java.sun.com/jsf/core"
                template="/resources/templates/template_site.xhtml">
    <ui:define name="content" >
        <p:panel header="#{utilLogin.util.prenom} panier" style="min-height: 100%;max-height: 100%">
            <p:contextMenu for="commandes">  
                <p:menuitem value="Confirm" icon="ui-icon-search" oncomplete="(#{utilLogin.util.typeclient != 'Prospect'})? confirmDialog.show():prospectDialog.show()"/>  
                <p:menuitem value="Delete"  icon="ui-icon-close" oncomplete="confirmation.show()"/>  
            </p:contextMenu> 
            
            <p:dialog widgetVar="prospectDialog" resizable="false">
                <h:panelGrid columns="2">
                <h:outputText value="#{bundle.Banque}"/>
                <p:inputText value="#{utilLogin.util.banque}" />
                <h:outputText value="#{bundle.NumCompte}"/>
                <p:inputText value="#{utilLogin.util.numcompte}" />
                <h:outputText value="#{bundle.Addresse}"/>
                <p:inputText value="#{utilLogin.util.adresseinsc}" />
                <p:commandButton value="Confirmer les changements et commander" oncomplete="prospectDialog.hide()" update="commandes" actionListener="#{utilLogin.confirmChangesAndCommand()}" />
                </h:panelGrid>
            </p:dialog>
            <p:confirmDialog widgetVar="confirmDialog" message="Vous voulez exécuter la commande?" header="Execution de la Commande" severity="alert"
                             >
                <p:commandButton  value="Oui" update="commandes" oncomplete="confirmDialog.hide()" style="margin-left: 30px"  
                                  actionListener="#{utilLogin.confirmCommand()}" />  
                <p:commandButton  value="Non" onclick="confirmDialog.hide()" type="button" style="margin-left: 80px"/> 
                
            </p:confirmDialog>
            <p:confirmDialog id="Dialog" message="Vous voulez supprimer cette reservation?"  
                             header="Processus de supression" severity="alert" widgetVar="confirmation">  

                <p:commandButton id="confirm" value="Oui" update="commandes" oncomplete="confirmation.hide()"  
                                 style="margin-left: 30px" actionListener="#{utilLogin.delete()}" />  
                <p:commandButton id="decline" value="Non" onclick="confirmation.hide()" type="button" style="margin-left: 110px"/>   

            </p:confirmDialog> 
            <p:messages showDetail="true" autoUpdate="true" showSummary="false" />
            <p:dataTable id="commandes" var="commande" value="#{utilLogin.itemCommanded}" 
                         rowKey="#{commande.idcommande}" paginator="true" rows="10"
                         selection="#{utilLogin.selectedCommandeclient}" selectionMode="single" > 
                <p:column >
                    <f:facet name="header" >
                        Nom de l'Item
                    </f:facet>
                    <h:outputText value="#{commande.iditem.nomitem}" />
                </p:column>                
                <p:column >
                    <f:facet name="header" >
                        Etat de la commande
                    </f:facet>
                    <h:outputText value="#{commande.etatcomm}" />
                </p:column>
                <p:column >
                    <f:facet name="header" >
                        Quantité de la réservation
                    </f:facet>
                    <h:outputText value="#{commande.quantite}" />
                </p:column>
                <p:column >
                    <f:facet name="header" >
                        Date de la réservation
                    </f:facet>
                    <h:outputText value="#{commande.dateReser}" />
                </p:column>
                <p:column >
                    <f:facet name="header" >
                        Date de la réservation
                    </f:facet>
                    <p:commandLink value="Confirmer " oncomplete="(#{utilLogin.util.typeclient != 'Prospect'})? confirmDialog.show():prospectDialog.show()" style="font-weight: bold"/>
                    <p:commandLink value="Supprimer" oncomplete="confirmation.show()" style="margin-left: 5px; font-weight: bold "/>
                </p:column>
            </p:dataTable>
        </p:panel>
    </ui:define>
</ui:composition>


